
{extend name='public/window' /}

{block name="content"}
<style>
    .layui-upload-drag {
        position: relative;
        padding: 10px;
        border: 1px dashed #e2e2e2;
        background-color: #fff;
        text-align: center;
        cursor: pointer;
        color: #999;
        border-radius: 50%;
    }
    .layui-form-label{
        width: 110px;
    }
    .layui-input-block{
        width: 85%;
        margin-left: 146px;
    }
    .layui-input, .layui-textarea {
        display: block;
        width: 80%;
        padding-left: 10px;
    }
    /* .layui-form-select {
        position: absolute;
        right: 165px;
        top: 50%;
        } */
    .layui-form-select .layui-edge {
        position: absolute;
        right: 170px !important;
        top: 50%;
    }
    .layui-form-select dl {
        min-width: 80% !important;
    }
    .layui-form-label {
        width: 116px !important;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="" lay-filter="form">
                {if isset($id)}
                <input type="hidden" name="id" value="{$id}">
                {/if}
                <input type="hidden" name="__token__" id="token" value="{:token()}"/>
                <div class="layui-form-item">
                    <label class="layui-form-label">品牌名称 * </label>
                    <div class="layui-input-block">
                        <input type="text"  disabled required autocomplete="off"
                               placeholder="请输入邮箱" class="layui-input" value="{$merchant.name}-{$merchant.berth_number}" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">开票类型 * </label>
                    <div class="layui-input-block">
                        <select name="type" lay-filter="type"  id="type">
                            <option value="1">个人</option>
                            <option value="0">公司</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">邮箱 *</label>
                    <div class="layui-input-block">
                        <input type="email" name="email"   autocomplete="off"
                               placeholder="请输入邮箱" class="layui-input" value="" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">开票抬头 *</label>
                    <div class="layui-input-block">
                        <input type="title" name="title" lay-verify="title" autocomplete="off"
                               placeholder="请输入开票抬头" class="layui-input" value="" >
                    </div>
                </div>
                <div id="xianshi" style="display:none">
                    <div class="layui-form-item">
                        <label class="layui-form-label">开户行账号 *</label>
                        <div class="layui-input-block">
                            <input type="bankAccount" name="bankAccount" lay-verify="bankAccount" autocomplete="off"
                                   placeholder="请输入开户行账号" class="layui-input" value="" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">税号 *</label>
                        <div class="layui-input-block">
                            <input type="taxNumber" name="taxNumber" lay-verify="taxNumber" autocomplete="off"
                                   placeholder="请输入税号" class="layui-input" value="" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">开户行名称 *</label>
                        <div class="layui-input-block">
                            <input type="bankName" name="bankName" lay-verify="bankName" autocomplete="off"
                                   placeholder="请输入开户行名称" class="layui-input" value="" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">公司地址 *</label>
                        <div class="layui-input-block">
                            <input type="companyAddress" name="companyAddress" lay-verify="companyAddress" autocomplete="off"
                                   placeholder="请输入公司地址" class="layui-input" value="" >
                        </div>
                    </div>
                </div>
                {if isset($info)}
                {if condition="$info['type'] eq 0"}
                    <div id="isshow">


                    <div class="layui-form-item">
                        <label class="layui-form-label">开户行账号 *</label>
                        <div class="layui-input-block">
                            <input type="bankAccount" name="bankAccount" lay-verify="bankAccount" autocomplete="off"
                                   placeholder="请输入开户行账号" class="layui-input" value="" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">税号 *</label>
                        <div class="layui-input-block">
                            <input type="taxNumber" name="taxNumber" lay-verify="taxNumber" autocomplete="off"
                                   placeholder="请输入税号" class="layui-input" value="" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">开户行名称 *</label>
                        <div class="layui-input-block">
                            <input type="bankName" name="bankName" lay-verify="bankName" autocomplete="off"
                                   placeholder="请输入开户行名称" class="layui-input" value="" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">公司地址 *</label>
                        <div class="layui-input-block">
                            <input type="companyAddress" name="companyAddress" lay-verify="companyAddress" autocomplete="off"
                                   placeholder="请输入公司地址" class="layui-input" value="" >
                        </div>
                    </div>
                    </div>
                {/if}
                {/if}
                <div class="layui-form-item layui-layout-admin " style="width: 100%">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0px;text-align: center;">
                            <button class="layui-btn" lay-submit="" lay-filter="add">{:__('Submit')}</button>
                        </div>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>


<script>
    layui.use(['element', 'form', 'jquery','lucky','upload','laydate','xmSelect'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var laydate = layui.laydate;
        var $ = layui.jquery;
        var lucky=layui.lucky;
        var xmSelect = layui.xmSelect;
        form.on('select(type)', function(data){
            var  type = data.value;
            if(type==2){
                $(".nolins").css('display','none'); //隐藏
                $("#isshow").css('display','none'); //显示
            }else{
                $(".nolins").css('display','block');
            }
        });
      form.on('select(type)', function(data){
            var  pid = data.value;
            if(pid==0){
                $("#xianshi").css('display','block'); //显示

            }else{
                $("#xianshi").css('display','none'); //显示
                $("#isshow").css('display','none'); //显示

            }
        });

        //表单赋值
        var info = {:json_encode($info)};
        form.val("form",info);
        form.on('submit(add)', function (data) {
            lucky.FormSubmit("{:url('updateInvoice')}",data.field,true);
            return false;
        });
    })
</script>

{/block}

